package com.xja.zufang.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DataUtil {

    private static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
    public static String dateToStrYMD(Date date){
        if (date==null)
            return null;
        return sdf.format(date);
    }

    public static Date strToDate(String dateStr){
        try {
            if (dateStr==null||"".equals(dateStr))
                return null;
            return sdf.parse(dateStr);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }



}
